import DialogBase from "../../../common/cmpt/base/DialogBase";
import Layer from "../../../common/cmpt/base/Layer";
import MoveBall from "./MoveBall";
import ThirdOrderBezierGrp from "./ThirdOrderBezierGrp";

const { ccclass, property } = cc._decorator;

@ccclass
export default class DlgBezierLine extends DialogBase {
    public static pUrl: string = 'LyDialog/DlgBezierLine'
    @property(MoveBall)                  //移动的球
    moveBall: MoveBall[] = []
    @property(ThirdOrderBezierGrp)                  //三阶。。节点
    tobgCtl: ThirdOrderBezierGrp = null


    // LIFE-CYCLE CALLBACKS:

    onLoad() {

    }

    start() {
        this.tobgCtl.init()
    }

    // update (dt) {}

    private async ball2Move() {
        let grp = this.tobgCtl.getPointsGrp()
        let startPos = this.tobgCtl.startPoint.getPosition()
        await this.moveBall[1].tweenMove(grp, startPos)
    }

    private delateOneGrp() {
        this.tobgCtl.delateOneGrp()
    }

    private addOneGrp(){
        this.tobgCtl.addOneGrp()
    }

    private tipServer(txt: string) {
        Layer.inst.showTip({ text: `${txt}`, end: cc.v2(0, 100), duration: 0.2 });
    }


}
